package com.szpx.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.szpx.entity.HZJ.jiaxiao;
import com.szpx.mapper.jiaxiaoMapper;
import com.szpx.service.jiaxiaoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;


@Service
@Transactional //事务处理策略
public class jiaxiaoServiceImpl implements jiaxiaoService {

    @Autowired
    private jiaxiaoMapper jiaxiaoMapper;


    @Override
    public List<jiaxiao> selectAlljiaxiao() {
        return jiaxiaoMapper.selectAll();
    }

    

        @Override
        public PageInfo<jiaxiao> getListByConPage(jiaxiao jiaxiao, int pageNum, int pageSize) {
            PageHelper.startPage(pageNum, pageSize);
            List<jiaxiao> list = jiaxiaoMapper.getListByCon(jiaxiao);
            return new PageInfo<>(list);
        }

        /**
         * 保存驾校信息
         * @param jiaxiao 要保存的驾校对象
         * @return 保存成功的记录数
         */
        @Override
        public int saveJiaxiao(jiaxiao jiaxiao) {
            return jiaxiaoMapper.saveJiaxiao(jiaxiao);
        }

        /**
         * 根据ID修改驾校信息
         * @param jiaxiao 要修改的驾校对象，需包含ID
         * @return 修改成功的记录数
         */
        @Override
        public int updateJiaxiaoById(jiaxiao jiaxiao) {
            return jiaxiaoMapper.updateJiaxiaoById(jiaxiao);
        }

        /**
         * 根据ID删除驾校信息
         * @param id 要删除的驾校ID
         * @return 删除成功的记录数
         */
        @Override
        public int deleteJiaxiaoById(Long id) {
            return jiaxiaoMapper.deleteJiaxiaoById(id);
        }

        @Override
        public jiaxiao getJiaxiaoById(Long id) {
            return jiaxiaoMapper.getJiaxiaoById(id);
        }

    
}
